<div class="easyui-layout" data-options="fit:true">
	<div data-options="region:'center',border:false">
		<!-- Begin of toolbar -->
		<div id="materiel-toolbar">
			<div class="materiel-toolbar-button">
					<a href="#" class="easyui-linkbutton" iconCls="icon-add" dialog-options="url:'${root!}/system/materiel/openadd',style:'width: 400px; padding: 10px;'" onclick="common_save(this)"
					plain="true">添加</a>
					<a href="#" class="easyui-linkbutton editbtn" iconCls="icon-edit" dialog-options="url:'${root!}/system/materiel/openadd',style:'width: 400px; padding: 10px;',src:'${root!}/system/materiel/edit'" onclick="common_save(this)"
					plain="true">修改</a>
					 <a href="#" class="easyui-linkbutton"
					iconCls="icon-remove" onclick="common_del(this)"  dialog-options="url:'${root!}/system/materiel/delete'" plain="true">删除</a> <a href="#"
					class="easyui-linkbutton" iconCls="icon-reload" onclick="common_refresh(this)" plain="true">刷新</a>
			</div>
			<div class="materiel-toolbar-search">
				<form id="materiel-search-form" method="post">
					<label>物料名称：</label><input class="wu-text" style="width: 100px" name="materiel.MaterielName">

					<label>所属产品：</label> <select class="easyui-combobox" panelHeight="auto"
						name="materiel.produceId" style="width: 130px" editable='false'>
						<option value="">全部产品</option> <#if (produces??) > <#list produces as p>
						<option value="${p.id!}">${p.produceName}</option> </#list> </#if>
					</select> <label>类型：</label> <select class="easyui-combobox" panelHeight="auto"
						name="materiel.categoryId" style="width: 130px" editable='false'>
						<option value="">全部物料</option> <#if materiel?? > <#list materiel as m>
						<option value="${m.paramId!}">${m.paramName}</option> </#list> </#if>
					</select> <a href="#" class="easyui-linkbutton" iconCls="icon-search" onclick="common_refresh(this)">查询</a>
				</form>
			</div>
		</div>
		<!-- End of toolbar -->
		<table id="materiel-datagrid" class="easyui-datagrid" toolbar="#materiel-toolbar"></table>
	</div>
</div>
<script type="text/javascript">
var mdata = {
      <#if materiel?? >
      <#list materiel as m>
      "${m.paramId!}": "${m.paramName!}",
      </#list>
      </#if>
  };

var pdata = {
		"0":"全部产品",
		<#if produces?? >
	      <#list produces as p>
	      "${p.id!}": "${p.produceName!}",
	      </#list>
	      </#if>
}

	/**
	 * Name 载入数据
	 */
	$('#materiel-datagrid').datagrid({
		url : 'system/materiel/getdata',
		rownumbers : true,
		singleSelect : false,
		pageSize : 10,
		pagination : true,
		multiSort : true,
		fitColumns : true,
		fit : true,
		columns : [ [ {
			checkbox : true
		}, {
			field : 'id',
			title : '产品编号',
			hidden : true,
			width : 100,
			sortable : true
		}, {
			field : 'MaterielId',
			title : '物料编码',
			width : 100,
			sortable : true
		}, {
			field : 'MaterielName',
			title : '物料/包装名称',
			width : 100,
			sortable : true
		}, {
			field : 'categoryId',
			title : '所属类型',
			width : 100,
			sortable : true,
			formatter: function (value) {
                return mdata[value];

            }
		}, {
			field : 'produceId',
			title : '所属产品',
			width : 100,
			sortable : true,
			formatter: function (value) {
				console.log(value,pdata);
                return pdata[value];

            }
		}, {
			field : 'alertNum',
			title : '数量警戒值',
			width : 100,
			sortable : true
		}, {
			field : 'alertTime',
			title : '预警时间(天)',
			width : 100,
			sortable : true
		} ] ]
	});
</script>